package com.ruoyi.biz.util;

import java.util.Objects;

/**
 * 激活码过期时间
 *
 * @author yusheng.liu
 * @since 2025/11/7 17:53
 */
public enum CodeExpireEnum {
    NEVER(-1, "永久"),

    MONTH(30, "月度"),

    THREE_MONTH(90, "季度"),

    YEAR(365, "年度");


    CodeExpireEnum(int day, String desc) {
        this.day = day;
        this.desc = desc;
    }


    private final Integer day;

    private final String desc;

    public Integer getDay() {
        return day;
    }

    public String getDesc() {
        return desc;
    }

    public  static CodeExpireEnum getBy(Integer day) {
        for (CodeExpireEnum cee : CodeExpireEnum.values()) {
            if (Objects.equals(cee.getDay(), day)) {
                return cee;
            }

        }

        return null;

    }
}
